import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FollowTransferVO, FollowTransferForm, FollowTransferQuery } from '@/api/goods/followTransfer/types';

/**
 * 查询跟单移交列表
 * @param query
 * @returns {*}
 */

export const listFollowTransfer = (query?: FollowTransferQuery): AxiosPromise<FollowTransferVO[]> => {
  return request({
    url: '/order/followTransfer/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询跟单移交详细
 * @param id
 */
export const getFollowTransfer = (id: string | number): AxiosPromise<FollowTransferVO> => {
  return request({
    url: '/order/followTransfer/' + id,
    method: 'get'
  });
};

/**
 * 新增跟单移交
 * @param data
 */
export const addFollowTransfer = (data: FollowTransferForm) => {
  return request({
    url: '/order/followTransfer',
    method: 'post',
    data: data
  });
};

/**
 * 修改跟单移交
 * @param data
 */
export const updateFollowTransfer = (data: FollowTransferForm) => {
  return request({
    url: '/order/followTransfer',
    method: 'put',
    data: data
  });
};

/**
 * 删除跟单移交
 * @param id
 */
export const delFollowTransfer = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/followTransfer/' + id,
    method: 'delete'
  });
};

export default {
  list: listFollowTransfer,
  get: getFollowTransfer,
  add: addFollowTransfer,
  update: updateFollowTransfer,
  del: delFollowTransfer,

}
